/*
 * ClientMessage.h
 *
 */

#ifndef CLIENTMESSAGE_H_
#define CLIENTMESSAGE_H_

#include "../common/TimeUtils.h"
#include "../common/Socket.h"
#include "../common/ServerConfig.h"
#include "../common/LogFile.h"
#include "Thread.h"
#include "http/HttpProtocol.h"
#include "http/HttpHost.h"

class ClientMessage : public Thread {
	private:
		TimeUtils creationTime;
		Socket* socket;
		HttpHost host;
		bool done;
		const std::string id;
		LogFile& logFile;
		void sendErrorRespone(HttpProtocol& protocol, int code);
	public:
		ClientMessage(Socket* socket, const ServerConfig& config, LogFile& log,
				const std::string& id);
		virtual ~ClientMessage();

		const std::string& getId() const;

		int getElapsedTime() const;

		bool finished() const;

		void run();

		/**
		 * Sobrecarga de método de Thread
		 */
		void die();
};

#endif /* CLIENTMESSAGE_H_ */
